﻿@model BlackBird.Models.ItemListViewDM
@using BlackBird.Models
@using BlackBird.Resources

@{
    ViewBag.Title = "ItemListView";
}

@section title_toolbar
{

    <nav>
        <ul id="button_command">
             @*
            <li><a class="newproject">@BBStrings.NewProject</a></li>
            <li><a class="newbijiadan">@BBStrings.CreateBiJiaDan</a></li>
            
            <li><a class="newincome" data-type="@SupportTypes.Income">@BBStrings.RecordShouRu</a></li>
            <li><a class="newexpend" data-type="@SupportTypes.Expend">@BBStrings.RecordZhiChu</a></li>
            *@
            <li><span class="returnHome">@Html.ActionLink(BBStrings.ReturnHome, "Index", "Home")</span></li>
        </ul>
    </nav>
}

<div id = "listitem_main_body">

    <div id = "listitem_filters">
        <div class = "item_width">
               <fieldset>
                <legend>类型类别</legend>
                  <div class="listitem_type_checkbox">
                    @{
                        var bijiandanCheckedStatus = Model.CheckedFilters.Contains(SupportTypes.BiJiaDan) ? "checked = checked" : null;
                        var incomeCheckedStatus = Model.CheckedFilters.Contains(SupportTypes.Income) ? "checked = checked" : null;
                        var expendCheckedStatus = Model.CheckedFilters.Contains(SupportTypes.Expend) ? "checked = checked" : null;
                        var fukuandanCheckedStatus = Model.CheckedFilters.Contains(SupportTypes.FukuanDan) ? "checked = checked" : null;
                    }
                    <input type="checkbox" name = "@SupportTypes.BiJiaDan.ToString()" value = "@SupportTypes.BiJiaDan.ToString()" @bijiandanCheckedStatus /> <span>@SupportTypes.BiJiaDan.PropertyToString()</span>
                    <input type="checkbox" name = "@SupportTypes.Income.ToString()" value = "@SupportTypes.Income.ToString()" @incomeCheckedStatus /> <span>@SupportTypes.Income.PropertyToString()</span>
                    <input type="checkbox" name = "@SupportTypes.Expend.ToString()" value = "@SupportTypes.Expend.ToString()" @expendCheckedStatus /> <span>@SupportTypes.Expend.PropertyToString()</span>
                    <input type="checkbox" name = "@SupportTypes.FukuanDan.ToString()" value = "@SupportTypes.FukuanDan.ToString()" @fukuandanCheckedStatus /> <span>@SupportTypes.FukuanDan.PropertyToString()</span>
                  </div>
              </fieldset>
              <fieldset>
                <legend>状态类别</legend>
                <div class = "listitem_status_checkbox">
                    <input type="checkbox" name = "@SupportTypeStatus.CaoGao.ToString()" value = "@SupportTypeStatus.CaoGao.ToString()" checked = "checked" /> <span>@SupportTypeStatus.CaoGao.PropertyToString()</span>
                    <input type="checkbox" name = "@SupportTypeStatus.ShengHeZhong.ToString()" value = "@SupportTypeStatus.ShengHeZhong.ToString()" checked = "checked" /> <span>@SupportTypeStatus.ShengHeZhong.PropertyToString()</span>
                    <input type="checkbox" name = "@SupportTypeStatus.ShenHeWanCheng.ToString()" value = "@SupportTypeStatus.ShenHeWanCheng.ToString()" checked = "checked" /> <span>@SupportTypeStatus.ShenHeWanCheng.PropertyToString()</span>
                    <input type="checkbox" name = "@SupportTypeStatus.GuiDang.ToString()" value = "@SupportTypeStatus.GuiDang.ToString()" checked = "checked" /> <span>@SupportTypeStatus.GuiDang.PropertyToString()</span>
                    <input type="checkbox" name = "@SupportTypeStatus.ZuoFei.ToString()" value = "@SupportTypeStatus.ZuoFei.ToString()" checked = "checked" /> <span>@SupportTypeStatus.ZuoFei.PropertyToString()</span>                                        
                </div>
              </fieldset>
          </div>
    </div>

    <div id = "listitem_body">
        <table>
            <colgroup>
                <col class="li_xuhao"/>
                <col class="li_leixing"/>
                <col class="li_zhuangtai" />
                <col class="li_mingcheng"/>
                <col class="li_chuangjianzhe"/>
                <col class="li_riqi"/>
            </colgroup>
            <thead>
                <tr>
                    <td>序号</td>
                    <td>类型</td>
                    <td>状态</td>
                    <td>名称</td>  
                    <td>创建者</td>
                    <td>日期</td>
                </tr>
            </thead>
            <tbody>
                @{ 
                int index = 0;
                foreach (var item in Model.Items)
                {
                    
                    var hiddenClass = Model.CheckedFilters.Contains(item.type) ? null : "typehidden";
                        <tr data-type = "@item.type" data-status="@item.status" data-id="@item.Id" class=@hiddenClass>
                            <td>@index</td>
                            <td>@item.type.PropertyToString()</td>
                            <td>@item.status.PropertyToString()</td>
                            <td>@Html.ActionLink(item.Name, MVC.Project.ActionNames.ItemDetailView, MVC.Project.Name, new { type = item.type, Id = item.Id }, new { target = "_blank" })</td>
                            <td>@item.CreateOwn</td>
                            <td>@item.CreateDate</td>
                        </tr>
                       index++;
                }
                }
            </tbody>
        </table>
    </div>

</div>
